<!DOCTYPE html>
<html>
<head>
    <title></title>
    <meta charset="utf-8"/>
    <link rel='stylesheet' href='public/stylesheets/index.css'/>
</head>
<body>
<header>
    <div class="headerLeft">
        <img src="public/images/znxl.png" alt="">
        <p>证念心理</p>
        <button onclick="window.location.href = `login.html`">退出登录</button>
        <button onclick="window.location.href=`putFile.html`">上传文件</button>
    </div>
</header>
<section>
    <!---->
    <div class="sectionList">
        <ul id="appManager" style="width:160px;display: none">
            <li onclick="showFragment(this,'frame/appManager/consult/index.html');">
                <img src="public/images/dhtp.png" alt="">
                <p>咨询师管理</p>
            </li>
            <li onclick="showFragment(this,'frame/appManager/consult_call/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>热线咨询师管理</p>
            </li>
            <li onclick="showFragment(this,'frame/appManager/consult_supervise/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>督导咨询师管理</p>
            </li>
            <li onclick="showFragment(this,'frame/appManager/packages/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>咨询套餐管理</p>
            </li>
            <li onclick="showFragment(this,'frame/appManager/address/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>咨询师地址管理</p>
            </li>
            <li onclick="showFragment(this,'frame/appManager/autoReply/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>自动回复</p>
            </li>
            <li onclick="showFragment(this,'frame/appManager/question/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>问过的问题</p>
            </li>
            <li onclick="showFragment(this,'frame/appManager/suggestion/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>帮助与建议</p>
            </li>
        </ul>
        <ul id="finance" style="width:160px;display: none">
            <li onclick="showFragment(this,'frame/finance/bill/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>每月账单</p>
            </li>
            <li onclick="showFragment(this,'frame/finance/bill_app/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>app账单</p>
            </li>
            <li onclick="showFragment(this,'frame/finance/bill_consumer/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>用户账单表</p>
            </li>
            <li onclick="showFragment(this,'frame/finance/bill_receiver/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>咨询账单表</p>
            </li>
            <li onclick="showFragment(this,'frame/finance/order/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>全部订单</p>
            </li>
            <li onclick="showFragment(this,'frame/finance/consult/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>咨询师</p>
            </li>
            <li onclick="showFragment(this,'frame/finance/user/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>用户</p>
            </li>
        </ul>
        <ul id="operate" style="width:160px;display: none">
            <li onclick="showFragment(this,'frame/operate/user/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>用户管理</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/video_series/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>视频</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/book/index.html')"><img src="public/images/dhtp.png" alt="">
                <p>书籍</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/essay_series/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>心理文章</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/activity/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>线下活动</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/articles/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>心理社区文章</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/evaluate/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>心理测评</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/learnWorldBanner/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>学会天地banner</p>
            </li>
            <li onclick="showFragment(this,'frame/operate/learnWorldNotify/index.html')">
                <img src="public/images/dhtp.png" alt="">
                <p>学会天地通知</p>
            </li>
        </ul>
        <ul id="examine" style="width:160px;display: none">
            <li onclick="showFragment(this,`frame/examine/admission_consult`)"><img src="public/images/dhtp.png" alt="">
                <p>咨询师入驻</p>
            </li>
            <li onclick="showFragment(this,`frame/examine/admission_company`)"><img src="public/images/dhtp.png" alt="">
                <p>单位会员入驻</p>
            </li>
            <li onclick="showFragment(this,`frame/examine/admission_user`)"><img src="public/images/dhtp.png" alt="">
                <p>个人会员入驻</p>
            </li>
        </ul>
    </div>
    <div class="sectionMain">
        <iframe id="external-frame" style="height:800px;width:100%" frameborder="0"></iframe>
    </div>
</section>
<footer>
    <div id="barcon" name="barcon"></div>
</footer>
<script src="frame/js/script_min.js"></script>
<script src="frame/js/util.js"></script>
<script>
    ServerAgent.invoke("backStage-isLogin",{role:getParams().role,login:getParams().login}).then(res=>{
        console.log(res);
        if(!res.args){
            window.location.href = `login.html`;
        }
    });
    let roleMap = {
        appManager:"appManager",
        examine:"examine",
        finance:"finance",
        operate:"operate",
    };
    let role = getParams()["role"];
    if(role){
        $(`#${roleMap[role]}`).css("display","block");
    }
    let showFragment = (doc,page)=>{
        window.sessionStorage.setItem("page",0);
        $('#external-frame').attr("src",page);
        let parentDoc = $(doc).parent().children();
        $(doc).attr("buttonId","aaa");
        for(let i = 0 ; i < parentDoc.length ; i++){
            if(parentDoc.eq(i).attr("buttonId") === "aaa"){
                window.sessionStorage.setItem("buttonId",i);
            }
            parentDoc.eq(i).css("background","#ffffff");
            parentDoc.eq(i).attr("buttonId","");
        }
        $(doc).css("background","#00ff00");
        window.sessionStorage.setItem("fragment",page);
    };
    if(window.sessionStorage.getItem("fragment")){
        $('#external-frame').attr("src",window.sessionStorage.getItem("fragment"));
        $(`#${roleMap[role]}`).children().eq(window.sessionStorage.getItem("buttonId")).css("background","#00ff00");
    }
</script>

</body>
</html>
